<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<ui:composition template="/WEB-INF/template/template.xhtml">
	<ui:define name="content">
		<h:form>
			<br />
			<div class="middle">
				<b><h:outputText value="#{msg.AD_editUnitMeasures_handler}"></h:outputText></b>
			</div>
			<br />
			<h:messages class="myError"></h:messages>
			<div class="middle">
				<h:outputText value="#{editMeasureunitsBean.message}"></h:outputText>
			</div>
			<br />
			<h:panelGrid class="panelGrid">
				<h:dataTable id="tabelMU" class="table" border="1"
					value="#{editMeasureunitsBean.listaMU}" var="dataItem">
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msg.AD_editUnitMeasures_name}"></h:outputText>
						</f:facet>
						<h:outputText value="#{dataItem.name}"></h:outputText>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msg.AD_editUnitMeasures_delete}"></h:outputText>
						</f:facet>
						<h:commandButton class="trashBtn" value="#{dataItem.id}" render="tabelMU"
							actionListener="#{editMeasureunitsBean.performDelete}"
							rendered="#{editMeasureunitsBean.exists(dataItem.id)}"
							onclick="#{msg.AD_editUnitMeasures_confMessage}">
							<f:attribute name="deleteMU" value="#{dataItem}" />
						</h:commandButton>
					</h:column>
				</h:dataTable>

				
				<h:panelGrid columns="1">
					<h:outputText style="margin-left:80px;"
						value="#{msg.AD_editUnitMeasures_new}" class="middle"></h:outputText>
					<h:inputText value="#{editMeasureunitsBean.nameMU}">
						<f:validator validatorId="validators.MeasureDuplicateValidator"></f:validator>
					</h:inputText>
					<div class="middle">
					
						<h:commandButton style="margin-left:100px;" class="button"
							value="#{msg.AD_editUnitMeasures_addUnit}" render="tabelMU"
							actionListener="#{editMeasureunitsBean.insertMeasureunitDTO}"
							onclick="#{msg.AD_editUnitMeasures_confMessage2}">
						</h:commandButton>
					</div>
				</h:panelGrid>
				
				</h:panelGrid>
			</h:form>
	</ui:define>
</ui:composition>
</html>